package cn.fornever.tools.db.assist.entity;

/**
 * 表信息.
 * <p>对应DatabaseMetaData.getTables()</p>
 *
 * @author ZhangAY
 */
public class TableInfo {
    /**
     * 1:Table Catlog。可能为 {@code null}
     */
    private String tableCat;
    /**
     * 2:Table Schem.可能为 {@code null}
     */
    private String tableSchem;
    /**
     * 3:表名
     */
    private String tableName;
    /**
     * 4:表类型.
     * <p>通常为:"TABLE","VIEW","SYSTEM TABLE","GLOBAL TEMPORARY","LOCAL TEMPORARY","ALIAS", "SYNONYM"</p>
     */
    private String tableType;
    /**
     * 5:表注释
     */
    private String remarks;
    private String typeCat;
    private String typeSchem;
    private String typeName;
    private String SelfReferencingColName;
    private String refGeneration;

    /**
     * 1:Table Catlog.可能为 {@code null}
     *
     * @return Table Catlog
     */
    public String getTableCat() {
        return tableCat;
    }

    /**
     * 1:Table Catlog.可能为 {@code null}
     *
     * @param tableCat Table Catlog
     */
    public void setTableCat(String tableCat) {
        this.tableCat = tableCat;
    }

    /**
     * 2:Table Schem.可能为 {@code null}
     *
     * @return Table Schem.
     */
    public String getTableSchem() {
        return tableSchem;
    }

    /**
     * 2:Table Schem.可能为 {@code null}
     *
     * @param tableSchem Table Schem.
     */
    public void setTableSchem(String tableSchem) {
        this.tableSchem = tableSchem;
    }

    /**
     * 3:Table Name.
     *
     * @return Table Name.
     */
    public String getTableName() {
        return tableName;
    }

    /**
     * 3:Table Name.
     *
     * @param tableName Table Name.
     */
    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    /**
     * 4:Table类型.
     * <p>通常为:"TABLE","VIEW","SYSTEM TABLE","GLOBAL TEMPORARY","LOCAL TEMPORARY","ALIAS", "SYNONYM"</p>
     *
     * @return Table类型.
     */
    public String getTableType() {
        return tableType;
    }

    /**
     * 4:Table类型.
     *
     * @param tableType Table类型.可选值通常为:"TABLE","VIEW","SYSTEM TABLE","GLOBAL TEMPORARY","LOCAL TEMPORARY","ALIAS", "SYNONYM"
     */
    public void setTableType(String tableType) {
        this.tableType = tableType;
    }

    /**
     * 5:表注释
     *
     * @return 表注释
     */
    public String getRemarks() {
        return remarks;
    }

    /**
     * 5:表注释
     *
     * @param remarks 表注释
     */
    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public String getTypeCat() {
        return typeCat;
    }

    public void setTypeCat(String typeCat) {
        this.typeCat = typeCat;
    }

    public String getTypeSchem() {
        return typeSchem;
    }

    public void setTypeSchem(String typeSchem) {
        this.typeSchem = typeSchem;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getSelfReferencingColName() {
        return SelfReferencingColName;
    }

    public void setSelfReferencingColName(String selfReferencingColName) {
        SelfReferencingColName = selfReferencingColName;
    }

    public String getRefGeneration() {
        return refGeneration;
    }

    public void setRefGeneration(String refGeneration) {
        this.refGeneration = refGeneration;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TableInfo tableInfo = (TableInfo) o;

        if (tableCat != null ? !tableCat.equals(tableInfo.tableCat) : tableInfo.tableCat != null) return false;
        if (tableSchem != null ? !tableSchem.equals(tableInfo.tableSchem) : tableInfo.tableSchem != null) return false;
        if (tableName != null ? !tableName.equals(tableInfo.tableName) : tableInfo.tableName != null) return false;
        if (tableType != null ? !tableType.equals(tableInfo.tableType) : tableInfo.tableType != null) return false;
        if (remarks != null ? !remarks.equals(tableInfo.remarks) : tableInfo.remarks != null) return false;
        if (typeCat != null ? !typeCat.equals(tableInfo.typeCat) : tableInfo.typeCat != null) return false;
        if (typeSchem != null ? !typeSchem.equals(tableInfo.typeSchem) : tableInfo.typeSchem != null) return false;
        if (typeName != null ? !typeName.equals(tableInfo.typeName) : tableInfo.typeName != null) return false;
        if (SelfReferencingColName != null ? !SelfReferencingColName.equals(tableInfo.SelfReferencingColName) : tableInfo.SelfReferencingColName != null)
            return false;
        return refGeneration != null ? refGeneration.equals(tableInfo.refGeneration) : tableInfo.refGeneration == null;

    }

    @Override
    public int hashCode() {
        int result = tableCat != null ? tableCat.hashCode() : 0;
        result = 31 * result + (tableSchem != null ? tableSchem.hashCode() : 0);
        result = 31 * result + (tableName != null ? tableName.hashCode() : 0);
        result = 31 * result + (tableType != null ? tableType.hashCode() : 0);
        result = 31 * result + (remarks != null ? remarks.hashCode() : 0);
        result = 31 * result + (typeCat != null ? typeCat.hashCode() : 0);
        result = 31 * result + (typeSchem != null ? typeSchem.hashCode() : 0);
        result = 31 * result + (typeName != null ? typeName.hashCode() : 0);
        result = 31 * result + (SelfReferencingColName != null ? SelfReferencingColName.hashCode() : 0);
        result = 31 * result + (refGeneration != null ? refGeneration.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "TableInfo{" +
                "tableCat='" + tableCat + '\'' +
                ", tableSchem='" + tableSchem + '\'' +
                ", tableName='" + tableName + '\'' +
                ", tableType='" + tableType + '\'' +
                ", remarks='" + remarks + '\'' +
                ", typeCat='" + typeCat + '\'' +
                ", typeSchem='" + typeSchem + '\'' +
                ", typeName='" + typeName + '\'' +
                ", SelfReferencingColName='" + SelfReferencingColName + '\'' +
                ", refGeneration='" + refGeneration + '\'' +
                '}';
    }


}
